{% extends "base.html" %} {% block title %}Appointment Details - Quick Care Connect{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

Appointment Details

Back to Appointments
Appointment Information
{% if appointment.status == 'expired_mutual_noshow' %} Mutual No-Show {% elif appointment.status == 'expired_patient_noshow' %} Missed Appointment {% elif appointment.status == 'expired_provider_failure' %} Doctor Missed {% else %} {{ appointment.status.replace('_', ' ').title() }} {% endif %}
{% if appointment.status == 'approved' %}
{% if appointment.payment_status == 'pending' %} Payment Pending {% elif appointment.payment_status == 'submitted' %} Under Review {% elif appointment.payment_status == 'approved' %} Payment Approved {% elif appointment.payment_status == 'rejected' %} Payment Rejected {% else %} Pending {% endif %}
{% endif %}
{{ appointment.appointment_date.strftime('%B %d, %Y') }}
{{ appointment.appointment_time.strftime('%I:%M %p') }}
{{ appointment.appointment_type.title() }}
PKR {{ "%.0f"|format(appointment.charges) }}
{% if appointment.hospital %}
{{ appointment.hospital }}
{% endif %}
{{ appointment.disease_category }}
{% if appointment.symptoms %}
{{ appointment.symptoms }}
{% endif %} {% if appointment.notes %}
{{ appointment.notes }}
{% endif %}
{{ appointment.created_at.strftime('%B %d, %Y at %I:%M %p') }}
{% if appointment.approved_at %}
{{ appointment.approved_at.strftime('%B %d, %Y at %I:%M %p') }}
{% endif %}
{% if get_current_user().role == 'patient' and appointment.status == 'approved' %}
Payment Information
{% if appointment.payment_status == 'pending' %}
Your appointment is approved! Complete your payment securely via PayFast to confirm your booking.
{% if appointment.payment_deadline %}
Payment Deadline
Complete payment before time expires
--:--
Due by {{ appointment.payment_deadline.strftime('%I:%M %p') }}
{% endif %}

Select Payment Method

{% if appointment.doctor.user.profile_picture %} Doctor {% else %}
{% endif %}
{{ appointment.doctor.user.name }}

{{ appointment.doctor.category }}

Security Guaranteed
Online Consultation
Rs. {{ "%.0f"|format(appointment.charges) }}
All Methods
VISA
Credit/Debit Card
Instant (0-60 seconds)
BANK TRANSFER
Slow (1 - 6 hours) + Manual verification required
easypaisa
Slow (1 - 6 hours) + Manual verification required
JazzCash
Slow (1 - 6 hours) + Manual verification required
{% elif appointment.payment_status == 'submitted' %}
Your payment screenshot has been submitted and is under admin review.
{% if appointment.payment_screenshot %}
View Screenshot
{% endif %} {% elif appointment.payment_status == 'approved' %} {% if get_current_user().role == 'patient' %}
Your payment has been approved by admin. You can now chat with the doctor.
{% elif get_current_user().role == 'doctor' %}
Payment has been approved. You can now chat with the patient.
{% endif %} {% if appointment.payment_screenshot %}
{% endif %}
{% if appointment.status == 'completed' %} View Chat History (Read-Only) {% if appointment.prescription %} My Prescription {% endif %} Appointment is completed. Chat is read-only. {% else %} {% if get_current_user().role == 'doctor' %}Start Chat with Patient{% else %}Start Chat with Doctor{% endif %} {% if appointment.appointment_type == 'video' %} {% if get_current_user().role == 'doctor' %} {# Doctors go to queue dashboard first #} Enter Consultation Lobby {# Hidden button for autostart functionality when coming from queue #} {% else %} {# Patients go directly to video call #} {% endif %} {% endif %} {% endif %}
{% elif appointment.payment_status == 'rejected' %}
Your payment has been rejected by admin. {% if appointment.payment_rejection_reason %}
Rejection Reason:

{{ appointment.payment_rejection_reason }}

{% endif %}
Payment Methods
JazzCash
Mobile Wallet

Account Number:

0300-1234567

Account Name:

Quick Care Connect

EasyPaisa
Mobile Wallet

Account Number:

0345-1234567

Account Name:

Quick Care Connect

Bank Account
Bank Transfer

Account Number (IBAN):

PK12ABCL0000001234567890

Bank Name:

Allied Bank Limited

Account Title:

Quick Care Connect

Bank Account (Alternative)
Bank Transfer

Account Number (IBAN):

PK12SCBL0000009876543210

Bank Name:

Standard Chartered Bank

Account Title:

Quick Care Connect

Important Instructions:
  • After making payment through any of the above methods, please upload a clear screenshot or photo of the payment confirmation.
  • Ensure the screenshot clearly shows transaction details, amount, transaction ID, and account number.
  • Payment confirmation will be reviewed by admin before approval.
Accepted formats: PNG, JPG, JPEG, PDF (Max 16MB). Please ensure the screenshot clearly shows transaction details, amount, and account number.
{% endif %}
{% endif %} {% if get_current_user().role == 'doctor' %} {% endif %} {% if get_current_user().role == 'doctor' %}
{% if appointment.status == 'pending' %}
{% elif appointment.status == 'approved' %} {% if appointment.patient_completed and not appointment.doctor_completed %}
Patient has marked this appointment as complete. Please confirm completion.
{% if appointment.prescription_unlocked %}
Consultation verified. You may now write the prescription.
{% else %}

Video only: both you and the patient must join the call; after 3 minutes of mutual connection the prescription unlocks (this page refreshes).

{% endif %} {% elif appointment.patient_completed and appointment.doctor_completed %}
Appointment Completed

Both you and the patient have confirmed completion.

{% else %} {# Show chat and video call buttons if payment is approved #} {% if appointment.payment_status == 'approved' %}
{% if appointment.status == 'completed' %} View Chat History (Read-Only) Appointment is completed. Chat is read-only. {% else %} Start Chat with Patient {% if appointment.appointment_type == 'video' %} {% if get_current_user().role == 'doctor' %} {# Doctors go to queue dashboard first #} Enter Consultation Lobby {% else %} {# Patients go directly to video call #} {# Calculate time difference #} {% set now = now_local() %} {% set apt_datetime = date_time_combine(appointment.appointment_date, appointment.appointment_time) %} {% set time_diff = (apt_datetime - now).total_seconds() / 60 %} {# Check if call is already active (doctor started, patient late) #} {% if appointment.is_call_active %} {# CALL IS ACTIVE - Show prominent "Doctor is waiting" banner #}
Doctor has started the call! They are waiting for you to join. {% if appointment.call_started_at %}
Call started {{ appointment.call_started_at.strftime('%I:%M %p') }} {% endif %}
{% elif time_diff <= 15 %} {# Time window is open but call not started yet #} {% else %} {# Too early to join #}
Link activates 15 mins before appointment
{% endif %} {% endif %} {% endif %} {% endif %}
{# --- Doctor can complete even if patient hasn't --- #} {# But this is gated by the consultation gate (prescription_unlocked) #} {% if get_current_user().role == 'doctor' and not appointment.doctor_completed %}
{% if appointment.prescription_unlocked %} {# ✅ CONSULTATION GATE: UNLOCKED #} {% else %} {# 🔒 CONSULTATION GATE: LOCKED #}

Video only: both parties in the call for 3 minutes unlocks the prescription.

{% endif %}
{% endif %} {% else %}
Waiting for patient payment approval before chat and video call become available.
Appointment Approved
{% endif %} {% endif %} {% endif %}
{% elif get_current_user().role == 'patient' %}
{% if appointment.status in ['completed', 'completed_pending_review'] %} {% set show_dispute = appointment.status == 'completed_pending_review' and (appointment.review or appointment.patient_review_skipped) and not appointment.patient_completed and (not appointment.completion_review_deadline or now_local() < appointment.completion_review_deadline) %} {% if appointment.status == 'completed_pending_review' %}

Consultation submitted

Your doctor has finished the visit. View your prescription if available, rate your experience (stars and a short written comment), then — if something was wrong — you can open a dispute.

{% endif %} {% if appointment.prescription %} {% endif %} {# ─── RATING & (THEN) DISPUTE ─────────────────────────────────────── #} {% if appointment.review %}

Your review

{% for i in range(1, 6) %} {% endfor %}
{% if appointment.review.comment %}

"{{ appointment.review.comment }}"

{% endif %}
{% if show_dispute %}

If there is a serious problem with this visit (incorrect prescription, missing documents, misconduct, billing, etc.), you can formally report it.

{% endif %} {% elif appointment.patient_review_skipped and not appointment.review %}

You chose not to leave a star rating for this visit.

{% if show_dispute %}

You can still report an issue if something was wrong.

{% endif %} {% elif not appointment.can_review %} {# Review window expired #}

The review period for this appointment has ended.

{% else %} {# Interactive rating (stars + required comment) #}

How was your experience with Dr. {{ appointment.doctor.user.name }}?

{% for i in range(1,6) %} {% endfor %}

Select what applied (optional)

{% for tag in ['Listened Carefully', 'Detailed Explanation', 'Friendly', 'Effective Treatment', 'Punctual'] %} {% endfor %}
{% for tag in ['Waited Too Long', 'Rushed', 'Technical Issues', 'Unhelpful', 'Poor Explanation'] %} {% endfor %}
{% endif %} {% elif appointment.status == 'approved' and appointment.payment_status == 'approved' %} {% if not appointment.patient_completed %} {% if appointment.doctor_completed %}

Has your appointment been completed? Mark it as complete to proceed.

{% else %}
Waiting for Doctor: The doctor must complete the appointment first before you can mark it as complete.
{% endif %} {% endif %} {% endif %}
{% endif %}
{% if get_current_user().role == 'patient' and appointment.status == 'completed_pending_review' and not appointment.patient_completed and (not appointment.completion_review_deadline or now_local() < appointment.completion_review_deadline) %} {% endif %}
{% if get_current_user().role == 'doctor' %} {% endif %} {% endblock %} {% block extra_js %} {% if appointment.payment_deadline and appointment.payment_status == 'pending' %} {% endif %} {% if get_current_user().role == 'doctor' and appointment.status == 'approved' and not appointment.doctor_completed %} {% endif %} {% endblock %}